﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.IO;


public partial class ResponseTest : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string dataFromClient = Server.UrlDecode(Request.Form.ToString());
        Response.Write("successed;");
        if (dataFromClient.Length == 0)
        {
            return;
        }

        if(Request.Cookies["username"] == null && Request.UserHostName.ToString() != "127.0.0.1")
            return;
        string domain = URL.getDomain(Request.Url.ToString());
        string domainSuf = URL.getDomainSuf(domain);
        string directory = "";
        if (Request.QueryString != null && Request.QueryString["flag"] != null)
        {
            directory = Request.QueryString["flag"];
        }
        if (Request.UserHostName.ToString() == "127.0.0.1")
        {
            Request.Cookies.Add(new HttpCookie("username", "www"));
        }
        handleDataFromClient.handle(dataFromClient, Request.Cookies["username"].Value,directory);//need to be modified.
    }
}
